<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function getResult() {
        var sum = 0,
          max = arguments[0],
          min = arguments[0],
          average = 0;
        for (var i = 0; i < arguments.length; i++) {
          sum += arguments[i];
          if (max < arguments[i]) {
            max = arguments[i];
          }
          if (min > arguments[i]) {
            min = arguments[i];
          }
          average = sum / arguments.length;
        }
        var obj = {
          sum: sum,
          max: max,
          min: min,
          average: average,
        };
        return obj;
      }
      console.log(getResult(2, 1, 3, 4, 6, 5));
    </script>
  </body>
</html>
